package com.service.business.support;


/**
 * <dl>
 * <dt>platform</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2015</dd>
 * </dl>
 */
public class ExpireTimeUtil {

    /**
     * 解锁时间7天
     */
    private static Integer expireDay = 7;

    private static Integer notPayExpireHour = 2;

    public static Integer getExpireTime(Integer time, Integer nowTime) {
        Integer expireTime = time + expireDay * 24 * 60 * 60;
        return expireTime > nowTime ? expireTime - nowTime : 0;
    }

    public static Integer getNotPayExpireTime(Integer time, Integer nowTime){
        Integer expireTime = time + notPayExpireHour * 60 * 60;
        return expireTime > nowTime ? expireTime - nowTime : 0;
    }

    public static String getDayHourStr(Integer time) {
        if (time <= 0) {
            return "0天0小时";
        }
        StringBuilder builder = new StringBuilder(10);
        int low = time / (24 * 3600);
        builder.append(low + "天");
        if (time % (24 * 3600) > 0) {
            low = (time % (24 * 3600)) / 3600;
            builder.append(low + "小时");
        }
        return builder.toString();
    }


}
